const util = require('../util');

class ConfigTemplate {
  constructor(config) {
    this.config = config;
  }

  generateFile() {
    this.text = `
      module.exports = {
        //用户类型
        USER_TYPE: {
          SUPER_ADMIN: 1,
          INFO_ADMIN: 2, //资讯管理员
          GOODS_ADMIN: 4, //商品管理员
          NOMAL: 3 //平台用户
        },
        env: process.env.NODE_ENV || 'test',
        app:{
          port: process.env.API_PORT || 5000,
        routerBaseApi: '/api'
        },
        jwt:{
          key: process.env.JWT || '7mXBS29DDpMwU6Y7xE3TfDczOHmmsdMl',
        expiresIn: '7d'
        },
        ipfs:{
          url: process.env.IPFS || ''
        },
        db:{
          host: process.env.DB_HOST || '${this.config.host}',
          database: process.env.DB_NAME || '${this.config.dbName}',
          user: process.env.DB_USER || '${this.config.user}',
          pwd: process.env.DB_PASSWORD || '${this.config.pwd}',
          port: process.env.DB_PORT || ${this.config.port}
        },
        chainsql:{
          root: {
            //系统根账号
            address: 'zN7TwUjJ899xcvNXZkNJ8eFFv2VLKdESsj',
            secret: 'p97evg5Rht7ZB7DbEpVqmV3yiSBMxR3pRBKJyLcRWt7SL5gEeBb'
          },
          tableOwner: {
            //用于管理chainsql表
            address: 'zUaTpihjtxyWP5UkPSnWTvvQUKUW9jyYbi',
            secret: 'pwa3PmsFUmiDBLDsbK8c4MsuMSnEtbMMAmCQAqxLRaZhsxQ3qip'
          },
          activate: {
            //用于激活新用户
            address: 'zMYAkQsJy64aefmS2pH3CLDddbEXY1Vzmd',
            secret: 'pwAJ9ZYLzih9XdgjoZqJNrFxpuhN7w7gF7ivuyMjwLm3veRv3Gz'
          },
          activateAmount: 15,
          ws: process.env.WS || '',
          rpc: process.env.RPC || ''
        }
      }
      
      `;
    return this.text;
  }
}

exports = module.exports = ConfigTemplate;
